$.ajaxPrefilter(function (options) {
    //
    options.url = 'http://ajax.frontend.itheima.net' + options.url
    //包含
    if (options.url.indexOf('/my/') !== -1) {
        options.headers = {
                Authorization: localStorage.getItem('token')
        }
    }
    //防止输入网址登陆 不管登陆成功失败都会执行判断
    options.complete = function (res) {
        // console.log(res);
        if (res.responseJSON.status === 1 && res.responseJSON.message === '身份认证失败！') {
            localStorage.removeItem('token');
            location.href = '/login.html'
        }
    }
})
